package com.gzs.zhdj.controller;


import com.gzs.zhdj.domain.entity.Organization;
import com.gzs.zhdj.service.OrganizationService;
import com.gzs.zhdj.utils.CommonResponse;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/admin/org")
@Slf4j
public class OrganizationController {

    @Autowired
    private OrganizationService organizationService;
    @PostMapping("/createorg")
    public CommonResponse createpartyOrg(@RequestBody Organization organization){
        log.info("组织信息, organization: {}", organization);
        organizationService.createPartyOrg(organization);
        return CommonResponse.ok();
    }
    @PutMapping("/updateorg")
    public CommonResponse updatepartyOrg(@RequestBody Organization organization){
        log.info("修改组织信息, organization: {}", organization);
        organizationService.updatePartyOrg(organization);
        return CommonResponse.ok();
    }
    @GetMapping("/getorg")
    public CommonResponse getOrganization(){
        List<Organization> name = organizationService.getOrgName();
        return CommonResponse.ok(name);
    }
}
